<%= stylesheet_link_tag 'user' %>
<div id="wrapProfil">
	<div id="profil">
		<h3>Meine Visitenkarte</h3>
		
		<form accept-charset="UTF-8" action="<%= @url %>" class="new_painting" enctype="multipart/form-data" id="new_painting" method="post">
			<table id="profileDetail">
			  <tr>
			  	<td rowspan="4"> 
			  		<% 
			  			ptu = ProjectToUser.find_by_user_id_and_project_id(current_user.current_project_id, current_user.id) unless current_user.current_project_id.nil?
			  			@rolename = Rolename.find_by_id(ptu.rolename_id).name unless ptu.nil?
			  		%>	
			  		<div><%= @rolename %> bei <%= Company.find_by_id(current_user.company_pid).name %></div>	
			  		<% paintings = Painting.where(:user_id => current_user.id)
			    	   if paintings.count == 1
			    	   	painting = paintings[0]
			    	   else
			    	   	painting = nil
			    	   end
			    	%>
			    	<% if !painting.nil? and painting.image? %>
			 			<%= image_tag(painting.image_url, :id => "avatar", :alt => "Avatar", :class => "avatar") %>
			 		<% else %>
			 			<%= image_tag("layout/user.png", :id => "avatar", :alt => "Kein Avatar Verfügbar", :class => "avatar") %>
			 		<% end %>
			 	</td>
			  </tr>
			  <tr>
			  	<td>
				    <b>Name:</b>
				</td>
				<td>
				    <%= current_user.name %>
				</td>
			  </tr>
			  <tr>
				 <td>
				    <b>Email:</b>
				 </td>
				 <td>
				    <%= current_user.email %>
				 </td> 
			  </tr>
			  <tr>
			  	<td></td>
			  	<td></td>
			  </tr>
			</table>
			
			<input type="submit" name="edit" id="edit" value="Bearbeiten" class="button">
		</form>
		<h3>Passwort &auml;ndern</h3>
		
		<table id="password">
			<tr>
				<td>Neues Passwort:</td>
				<td><input type="password" name="password1" id="password1"></td>
			</tr>
			<tr>
				<td>Best&auml;tigen:</td>
				<td><input type="password" name="password2" id="password2"></td>
			</tr>
		</table>
		
		<input type="button" name="savePassword" id="savePassword" value="Speichern" class="button">
	</div>
</div>